﻿namespace Mohe.Scada.Util.Queue
{
    /// <summary>
    /// 定长队列
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class FixedQueue<T> : Queue<T> where T : class
    {
        private int _count;
        public FixedQueue()
        {
            _count = 100;
        }

        public FixedQueue(int count)
        {
            _count = count;
        }

        public new void Enqueue(T item)
        {
            if (this.Count > _count)
            {
                Dequeue();
            }
            base.Enqueue(item);
        }
    }
}
